//
//  HelpViewController.m
//  BUS365
//
//  Created by login on 15-8-12.
//
//

#import "HelpViewController.h"
//#import "UppayWindow.h"
#define DEFAULTCOLOR [UIColor colorWithRed:61.0/255.0 green:154.0/255.0 blue:240.0/255.0 alpha:1.0]//#3d9af0

@interface HelpViewController ()<UIWebViewDelegate>
{
    UIView *navaView;//返回按钮的父视图
    UIActivityIndicatorView *activityIndicator;
}
@end

@implementation HelpViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self initView];
}

- (void)initView
{
    UIWebView *helpWeb = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    NSURLRequest *request =[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://wwwd.bus365.cn/m_ticket/#CouponNote"]];
    helpWeb.delegate = self;
    [self.view addSubview: helpWeb];
    [helpWeb loadRequest:request];
    
    navaView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 60)];
    navaView.backgroundColor = DEFAULTCOLOR;
    [self.view addSubview:navaView];
    
    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 20, self.view.frame.size.width, 40)];
    label.text = @"选择出发地点";
    label.backgroundColor = DEFAULTCOLOR;
    label.textAlignment = NSTextAlignmentCenter;
    label.textColor = [UIColor whiteColor];
    label.font = [UIFont systemFontOfSize:20];
    [navaView addSubview:label];
    

    UIButton *returnView = [[UIButton alloc]initWithFrame:CGRectMake(10, 30, 60, 20)];
    [returnView addTarget:self action:@selector(closeWindow) forControlEvents:UIControlEventTouchUpInside];
    [navaView addSubview:returnView];
    
    UIImageView *back = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 20, 20)];
    back.image = [UIImage imageNamed:@"back"];
    [returnView addSubview:back];
    
    UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(20, 0, 40, 20)];
    [button setTitle:@"返回" forState:UIControlStateNormal];
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(closeWindow) forControlEvents:UIControlEventTouchUpInside];
    [returnView addSubview:button];


}
//- (void)closeWindow
//{
//    UppayWindow *upWindow = (UppayWindow *)self.view.window;
//    [upWindow dismiss];
//}
- (void)webViewDidStartLoad:(UIWebView *)webView
{
//    UIView *view = [[UIView alloc] initWithFrame:self.view.frame];
//    [view setTag:108];
//    [view setBackgroundColor:[UIColor whiteColor]];
////    [view setAlpha:0.5];
//    [self.view addSubview:view];
//    
//    activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 32.0f, 32.0f)];
//    [activityIndicator setCenter:view.center];
//    [activityIndicator setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleWhite];
//    [view addSubview:activityIndicator];
//    
//    [activityIndicator startAnimating];

}

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
//    [webView stringByEvaluatingJavaScriptFromString:@"$('#header').css('display','none')"];
    
//    [activityIndicator stopAnimating];
//    UIView *view = (UIView*)[self.view viewWithTag:108];
//    [view removeFromSuperview];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
